home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / vbcc-ppc / doc / vbcci386.doc < prev    next >
Text File  |  1999-01-01  |  5KB  |  128 lines

  1. vbcc - C compiler (c) in 1995-99 by Volker Barthelmann
  2.  
  3.  
  4. INTRODUCTION
  5.  
  6.     vbcc is a free portable and retargetable ANSI C compiler.
  7.     It is clearly split into a target independant and a target dependant
  8.     part and supports emulating datatypes of the target machine on any
  9.     other machine so that it is possible to e.g. make a crosscompiler for
  10.     a 64bit machine on a 32bit machine.
  11.     This document only deals with the target dependant parts of the
  12.     i386 version.
  13.  
  14.  
  15. LEGAL
  16.  
  17.     vbcc is (c) in 1995-99 by Volker Barthelmann. All code is written by me
  18.     and may be freely redistributed as long as no modifications are made
  19.     and nothing is charged for it.
  20.     Non-commercial usage of vbcc is allowed without any restrictions.
  21.     Commercial usage needs my written consent.
  22.  
  23.     Sending me money, gifts, postcards etc. would of course be very nice
  24.     and may encourage further development of vbcc, but is not legally or
  25.     morally necessary to use vbcc.
  26.  
  27.  
  28. ADDITIONAL OPTIONS FOR THIS VERSION
  29.  
  30.     -longalign  Align multibyte-values on 4-byte-boundaries. Needed by some
  31.                 operating systems.
  32.  
  33.     -elf        Do not use a '_'-prefix in front of external identifiers.
  34.                 Use a '.'-prefix for label names.
  35.  
  36.     -merge-constants
  37.  
  38.                 Place identical floating point constants at the same
  39.                 memory location. This can reduce program size and increase
  40.                 compilation time.
  41.  
  42.     -const-in-data
  43.  
  44.                 By default constant data will be placed in the code
  45.                 section (and therefore is accessable with faster pc-relative
  46.                 addressing modes). Using this option it will be placed in the
  47.                 data section.
  48.                 Note that on operating systems with memory protection this
  49.                 option will disable write-protection of constant data.
  50.  
  51.     -no-delayed-popping
  52.  
  53.                 By default arguments of function calls are not always popped
  54.                 from the stack immediately after the call, so that the
  55.                 arguments of several calls may be popped at once.
  56.                 With this option vbcc can be forced to pop them after every
  57.                 function call.
  58.                 This may simplify debugging and very slightly reduce the
  59.                 stack size needed by the compiled program.
  60.  
  61.     -safe-fp    Do not use the floating-point-stack for register variables.
  62.                 At the moment this is necessary as vbcci386 still has problems
  63.                 in some cases otherwise.
  64.  
  65.  
  66. SOME INTERNALS
  67.  
  68.     The current version generates assembly output for use with the GNU
  69.     assembler. The generated code should work on systems with Intel 80386
  70.     or higher CPUs with FPU.
  71.  
  72.     The register names are:
  73.  
  74.         %eax, %ebx, %ecx, %edx
  75.         %esi, %edi, %ebp, %esp
  76.  
  77.         (and %st(0)-%st(7) for the floating point stack but you must not
  78.          use it for register variables because it cannot be handled like
  79.          normal registers)
  80.  
  81.     The registers %eax, %ecx and %edx (as well as the floating point stack)
  82.     are used as scratch registers (i.e. they can be destroyed in function
  83.     calls), all other registers are preserved.
  84.  
  85.     All elementary types up to 4 bytes are returned in register %eax
  86.     Floating point values are returned in %st(0).
  87.     All other types are returned by passing the function the address
  88.     of the result as a hidden argument - so when you call such a function
  89.     without a proper declaration in scope you can expect a crash.
  90.  
  91.     vbcc uses %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp and the floating point
  92.     stack for temporary results and register variables. Local variables
  93.     are created on the stack and addressed via %esp.
  94.  
  95.     The elementary data types are represented like:
  96.  
  97.     type        size in bits        alignment in bytes(with -longalign)
  98.  
  99.     char                8                       1
  100.     short              16                       2(4)
  101.     int                32                       2(4)
  102.     long               32                       2(4)
  103.     all pointers       32                       2(4)
  104.     float              32                       2(4)
  105.     double             64                       2(4)
  106.  
  107.  
  108. STDARG
  109.  
  110.     A possible <stdarg.h> could look like this:
  111.  
  112.     typedef unsigned char *va_list;
  113.  
  114.     #define va_start(ap, lastarg) ((ap) = (va_list)(&lastarg + 1))
  115.     #define va_arg(ap, type) ((ap) += \
  116.       (sizeof(type)<sizeof(int)?sizeof(int):sizeof(type)), ((type *)(ap))[-1])
  117.     #define va_end(ap) ((ap) = 0L)
  118.  
  119.  
  120. KNOWN PROBLEMS
  121.  
  122.     - generated code is very poor
  123.     - functions which return floating-point values don't work
  124.  
  125.  
  126. Volker Barthelmann                                      volker@vb.franken.de
  127.  
  128.